/*
 *    Copyright 2009-2022 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.apache.ibatis.AAMyDemo.dao;

import org.apache.ibatis.AAMyDemo.domain.MyTest;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;


/**
 * @Author yangSen
 * @Date 2022年03月16日 12:38
 */
@CacheNamespace  // 开启二级缓存
public interface TestAnnDao {

  /**
   * 通过id查询
   *
   * @param id
   * @return
   */
  @Select("select * from test where id = #{id}")
//  @Options(flushCache = Options.FlushCachePolicy.TRUE)
  MyTest testSelectById(Integer id);


  /**
   * 通过id 和 name 查询
   *
   * @param id
   * @return
   */
  @Select("select * from test where id = #{id} and name = #{name}")
  MyTest testSelectByIdAndName(@Param("id") Integer id, @Param("name") String name);


  @Update("update test set name = #{name} where id = #{id} ")
  void testUpdate(@Param("id") Integer id, @Param("name") String name);

}
